home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 371_01 / windosio.h < prev   
Text File  |  1992-01-10  |  33KB  |  1,014 lines

  1. /**************************************************************************
  2. *  WinDosIO.h
  3. *  These functions allow standard IO compatability when executing under
  4. *  Microsoft Windows 3.0. They represent the complete interface to the
  5. *  Graubart-Cervone WinDosIO library.
  6. *  Copyright 1991, Graubart-Cervone Software
  7. ***************************************************************************/
  8. #if !defined(WINDOSIO_H )
  9. #define WINDOSIO_H
  10.  
  11. #define _NOCURSOR      0
  12. #define _SOLIDCURSOR   1
  13. #define _NORMALCURSOR  2
  14. #define _USERCURSOR    99
  15.  
  16.  
  17. struct text_info {
  18.     unsigned char winleft;
  19.     unsigned char wintop;
  20.     unsigned char winright;
  21.     unsigned char winbottom;
  22.     unsigned char attribute;
  23.     unsigned char normattr;
  24.     unsigned char currmode;
  25.     unsigned char screenheight;
  26.     unsigned char screenwidth;
  27.     unsigned char curx;
  28.     unsigned char cury;
  29. };
  30.  
  31. enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
  32.  
  33.  
  34.  
  35.  
  36. enum graphics_errors {        /* graphresult error return codes */
  37.     grOk           =   0,
  38.     grNoInitGraph       =  -1,
  39.     grNotDetected       =  -2,
  40.     grFileNotFound       =  -3,
  41.     grInvalidDriver    =  -4,
  42.     grNoLoadMem       =  -5,
  43.     grNoScanMem       =  -6,
  44.     grNoFloodMem       =  -7,
  45.     grFontNotFound       =  -8,
  46.     grNoFontMem       =  -9,
  47.     grInvalidMode       = -10,
  48.     grError        = -11,   /* generic error */
  49.     grIOerror       = -12,
  50.     grInvalidFont       = -13,
  51.     grInvalidFontNum   = -14,
  52.     grInvalidVersion   = -18,
  53.     grMSParameter       = -40,
  54.     grMSImage       = -41,
  55.     grMSNoOutput       = -42,
  56.     grMSClipped       = -43,
  57.     grMSParmAltered    = -44
  58. };
  59.  
  60. enum graphics_drivers {     /* define graphics drivers */
  61.     DETECT,         /* requests autodetection */
  62.     CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,    /* 1 - 6 */
  63.     HERCMONO, ATT400, VGA, PC3270,            /* 7 - 10 */
  64.     CURRENT_DRIVER = -1
  65. };
  66.  
  67. enum graphics_modes {        /* graphics modes for each driver */
  68.     CGAC0      = 0,  /* 320x200 palette 0; 1 page    */
  69.     CGAC1      = 1,  /* 320x200 palette 1; 1 page    */
  70.     CGAC2      = 2,  /* 320x200 palette 2: 1 page    */
  71.     CGAC3      = 3,  /* 320x200 palette 3; 1 page    */
  72.     CGAHI      = 4,  /* 640x200 1 page            */
  73.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page    */
  74.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page    */
  75.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page    */
  76.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page    */
  77.     MCGAMED    = 4,  /* 640x200 1 page            */
  78.     MCGAHI     = 5,  /* 640x480 1 page            */
  79.     EGALO      = 0,  /* 640x200 16 color 4 pages    */
  80.     EGAHI      = 1,  /* 640x350 16 color 2 pages    */
  81.     EGA64LO    = 0,  /* 640x200 16 color 1 page     */
  82.     EGA64HI    = 1,  /* 640x350 4 color  1 page     */
  83.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  84.     HERCMONOHI = 0,  /* 720x348 2 pages         */
  85.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page    */
  86.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page    */
  87.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page    */
  88.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page    */
  89.     ATT400MED  = 4,  /* 640x200 1 page            */
  90.     ATT400HI   = 5,  /* 640x400 1 page            */
  91.     VGALO      = 0,  /* 640x200 16 color 4 pages    */
  92.     VGAMED     = 1,  /* 640x350 16 color 2 pages    */
  93.     VGAHI      = 2,  /* 640x480 16 color 1 page     */
  94.     PC3270HI   = 0,  /* 720x350 1 page            */
  95.     IBM8514LO  = 0,  /* 640x480 256 colors        */
  96.     IBM8514HI  = 1   /*1024x768 256 colors        */
  97. };
  98.  
  99. /* Colors for setpalette and setallpalette */
  100.  
  101. #if    !defined(__COLORS)
  102. #define __COLORS
  103.  
  104. enum COLORS {
  105.     BLACK,            /* dark colors */
  106.     BLUE,
  107.     GREEN,
  108.     CYAN,
  109.     RED,
  110.     MAGENTA,
  111.     BROWN,
  112.     LIGHTGRAY,
  113.     DARKGRAY,            /* light colors */
  114.     LIGHTBLUE,
  115.     LIGHTGREEN,
  116.     LIGHTCYAN,
  117.     LIGHTRED,
  118.     LIGHTMAGENTA,
  119.     YELLOW,
  120.     WHITE
  121. };
  122. #endif
  123.  
  124. enum CGA_COLORS {
  125.     CGA_LIGHTGREEN     = 1,        /* Palette C0 Color Names    */
  126.     CGA_LIGHTRED       = 2,
  127.     CGA_YELLOW           = 3,
  128.  
  129.     CGA_LIGHTCYAN      = 1,        /* Palette C1 Color Names    */
  130.     CGA_LIGHTMAGENTA   = 2,
  131.     CGA_WHITE           = 3,
  132.  
  133.     CGA_GREEN           = 1,        /* Palette C2 Color Names    */
  134.     CGA_RED           = 2,
  135.     CGA_BROWN           = 3,
  136.  
  137.     CGA_CYAN           = 1,        /* Palette C3 Color Names    */
  138.     CGA_MAGENTA        = 2,
  139.     CGA_LIGHTGRAY      = 3
  140. };
  141.  
  142.  
  143. enum EGA_COLORS {
  144.     EGA_BLACK         =  0,        /* dark colors */
  145.     EGA_BLUE         =  1,
  146.     EGA_GREEN         =  2,
  147.     EGA_CYAN         =  3,
  148.     EGA_RED         =  4,
  149.     EGA_MAGENTA      =  5,
  150.     EGA_BROWN         =  20,
  151.     EGA_LIGHTGRAY     =  7,
  152.     EGA_DARKGRAY     =  56,     /* light colors */
  153.     EGA_LIGHTBLUE     =  57,
  154.     EGA_LIGHTGREEN     =  58,
  155.     EGA_LIGHTCYAN     =  59,
  156.     EGA_LIGHTRED     =  60,
  157.     EGA_LIGHTMAGENTA     =  61,
  158.     EGA_YELLOW         =  62,
  159.     EGA_WHITE         =  63
  160. };
  161.  
  162. enum line_styles {        /* Line styles for get/setlinestyle */
  163.     SOLID_LINE   = 0,
  164.     DOTTED_LINE  = 1,
  165.     CENTER_LINE  = 2,
  166.     DASHED_LINE  = 3,
  167.     USERBIT_LINE = 4,    /* User defined line style */
  168.     DASHDOT_LINE = 5,
  169.     DASHDOTDOT_LINE = 6
  170. };
  171.  
  172. enum line_widths {        /* Line widths for get/setlinestyle */
  173.     NORM_WIDTH  = 1,    /* WinDosIO allows any line thickness */
  174.     THICK_WIDTH = 3,    /* Mneumonics for compatability only */
  175. };
  176.  
  177. enum font_names {
  178.     DEFAULT_FONT    = 0,    /* 8x8 bit mapped font */
  179.     TRIPLEX_FONT    = 1,    /* "Stroked" fonts */
  180.     SMALL_FONT    = 2,
  181.     SANS_SERIF_FONT = 3,
  182.     GOTHIC_FONT    = 4,
  183.     MICROSTYLE_FONT = 99
  184. };
  185.  
  186. #define HORIZ_DIR    0    /* left to right */
  187. #define VERT_DIR    1    /* bottom to top */
  188.  
  189. #define USER_CHAR_SIZE    0    /* user-defined char size */
  190.  
  191. enum fill_patterns {        /* Fill patterns for get/setfillstyle */
  192.     EMPTY_FILL,        /* fills area in background color */
  193.     SOLID_FILL,        /* fills area in solid fill color */
  194.     LINE_FILL,        /* --- fill */
  195.     LTSLASH_FILL,        /* /// fill */
  196.     SLASH_FILL,        /* /// fill with thick lines */
  197.     BKSLASH_FILL,        /* \\\ fill with thick lines */
  198.     LTBKSLASH_FILL,     /* \\\ fill */
  199.     HATCH_FILL,        /* light hatch fill */
  200.     XHATCH_FILL,        /* heavy cross hatch fill */
  201.     INTERLEAVE_FILL,    /* interleaving line fill */
  202.     WIDE_DOT_FILL,        /* Widely spaced dot fill */
  203.     CLOSE_DOT_FILL,     /* Closely spaced dot fill */
  204.     USER_FILL        /* user defined fill */
  205. };
  206.  
  207. enum putimage_ops {        /* BitBlt operators for putimage */
  208.     COPY_PUT,        /* MOV */
  209.     XOR_PUT,        /* XOR */
  210.     OR_PUT,         /* OR  */
  211.     AND_PUT,        /* AND */
  212.     NOT_PUT         /* NOT */
  213. };
  214.  
  215. enum text_just {        /* Horizontal and vertical justification
  216.                    for settextjustify */
  217.     LEFT_TEXT    = 0,
  218.     CENTER_TEXT    = 1,
  219.     RIGHT_TEXT    = 2,
  220.  
  221.     BOTTOM_TEXT    = 0,
  222.      /* CENTER_TEXT    = 1,  already defined above */
  223.     TOP_TEXT    = 2
  224. };
  225.  
  226.  
  227. #define MAXCOLORS 15
  228. #define MAXPAGES  4
  229.  
  230. struct palettetype {
  231.     unsigned char size;
  232.     signed char colors[MAXCOLORS+1];
  233. };
  234.  
  235. struct linesettingstype {
  236.     int linestyle;
  237.     unsigned upattern;
  238.     int thickness;
  239. };
  240.  
  241. struct textsettingstype {
  242.     int font;
  243.     int direction;
  244.     int charsize;
  245.     int horiz;
  246.     int vert;
  247. };
  248.  
  249. struct fillsettingstype {
  250.     int pattern;
  251.     int color;
  252. };
  253.  
  254. struct pointtype {
  255.     int x, y;
  256. };
  257.  
  258. struct viewporttype {
  259.     int left, top, right, bottom;
  260.     int clip;
  261. };
  262.  
  263. struct arccoordstype {
  264.     int x, y;
  265.     int xstart, ystart, xend, yend;
  266. };
  267.  
  268. struct CWS {
  269.     char far *cwsTitle;
  270.     unsigned long cwsFlags;
  271.     short cwsLeft;
  272.     short cwsTop;
  273.     short cwsXSize;
  274.     short cwsYSize;
  275. };
  276.  
  277.  
  278.  
  279. #if !defined( __DEFS_H )
  280. #include <_defs.h>
  281. #endif
  282.  
  283. #ifndef NULL
  284. #include <_null.h>
  285. #endif
  286.  
  287. #ifndef _SIZE_T
  288. #define _SIZE_T
  289. typedef unsigned size_t;
  290. #endif
  291.  
  292. /* Definition of the file position type
  293. */
  294. typedef long    fpos_t;
  295.  
  296.  
  297. /* Definition of the control structure for streams
  298. */
  299. typedef struct  {
  300.         int             level;          /* fill/empty level of buffer */
  301.         unsigned        flags;          /* File status flags          */
  302.         char            fd;             /* File descriptor            */
  303.         unsigned char   hold;           /* Ungetc char if no buffer   */
  304.         int             bsize;          /* Buffer size                */
  305.         unsigned char   _FAR *buffer;   /* Data transfer buffer       */
  306.         unsigned char   _FAR *curp;     /* Current active pointer     */
  307.         unsigned        istemp;         /* Temporary file indicator   */
  308.         short